<?php
mb_internal_encoding ( "UTF-8" );
header ( 'Content-Type: text/html; charset=UTF-8' );

$inferior = ( int ) $_REQUEST ['inferior'] - 1;
$superior = ( int ) $_REQUEST ['superior'] - 1;

$signos = array (
		"Capricornio",
		"Acuario",
		"Piscis",
		"Aries",
		"Tauro",
		"Géminis",
		"Cáncer",
		"Leo",
		"Virgo",
		"Libra",
		"Escorpio",
		"Sagitario" 
);

$meses = array (
		"Enero",
		"Febrero",
		"Marzo",
		"Abril",
		"Mayo",
		"Junio",
		"Julio",
		"Agosto",
		"Septiembre",
		"Octubre",
		"Noviembre",
		"Diciembre" 
);

$radio = "";
$select = "<select name='mes' id='mes'>\r\n";

for($i = $inferior; $i <= $superior; $i ++) {
	$signo = $signos [$i];
	$checked = "";
	
	$mes = $meses [$i];
	
	if ($i == $inferior) {
		$checked = "checked = 'checked'";
	}
	
	$radio .= "<input type='radio' name='signo' id='signo' $checked value='$signo'>\r\n";
	$radio .= "<label for=''>$signo</label><br/>\r\n";
	
	$select .= "<option value='$mes' $checked>$mes</option>\r\n";
}

$select .= "</select>";

echo <<<HTML
<!DOCTYPE html>
<html lang="es">
<head>
	<meta http-equiv="Content-Type" content="text/html"; charset="UTF-8" />
	<title>Ejercicio 1</title>
</head>
<body>
	
	<form action="final.php" method="post">
		<fieldset>
			<legend>Signos del zodiaco</legend>
			$radio
		</fieldset>
		
		<fieldset>
			<legend>Meses de año</legend>
			$select
		</fieldset>
					
		<input type="submit" value="Continuar">
	</form>
	
</body>
</html>
HTML;

?>